import store from './store';
import event, { on, once, off, trigger } from './event';
import log from './log';

/**
 * 导出常用存储函数到全局，其它高级配置使用 '.store.xxx()'
 * 或直接 import {xxx} from 'cmn-utils/lib/store'
 */
const setStore       = store.setStore;
const getStore       = store.getStore
const removeStore    = store.removeStore;
const clearStore     = store.clearStore;

export { store };

const debug     = log.debug;
const info      = log.info;
const warn      = log.warn;
const error     = log.error;
export { log };

/**
 * default export
 */
const L = {
  // store api
  store, setStore, getStore, removeStore, clearStore,
  // event api
  event, on, once, off, trigger,
  // common utils
  ...require('./cmutils'),
  // dva core
  ...require('./core'),

  // log
  log, debug, info, warn, error,
}

if (L.__esModule) delete L.__esModule;

export default L;
